package io.openmessaging;

public class 两数之和 {
    public static void main(String[] args) {
        int[] numbers=new int[]{2,7,11,15};
        int target=9;
        int start=0;
        int end=numbers.length-1;
        int[] re=new int[2];
        while(start<end){
            int sum=numbers[start]+numbers[end];
            if(sum==target){
                re[0]=start;
                re[1]=end;
               System.out.println(222);
            }
            if(sum<target){
                start=start+1;
            }
            if(sum>target){

                end=end-1;
            }
        }
    }
}
